<?php

namespace App\Http\Middleware;

use Closure;
use Illuminate\Http\Request;

class UserGroup
{
    /**
     * Handle an incoming request.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  \Closure(\Illuminate\Http\Request): (\Illuminate\Http\Response|\Illuminate\Http\RedirectResponse)  $next
     * @return \Illuminate\Http\Response|\Illuminate\Http\RedirectResponse
     */
    /*public function handle(Request $request, Closure $next)
    {
        // 执行操作
        if ($request->get('group')!=3) {
            return redirect('home');
        }

        return $next($request);
    }*/

    /*public function handle($request, Closure $next)
    {
        $response = $next($request);

        // 执行操作

        return $response;
    }*/


    // 中间件参数
    public function handle($request, Closure $next, $role)
    {
        var_dump($role);
        // if (!$request->user()->hasRole($role)) {
            
        // }

        return $next($request);
    }
}
